/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import dao.MemberDao;
import dao.OrderDao;
import entity.Member;
import entity.OrderForm;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author zhang
 */
@WebServlet("/gobbn")
public class GetOrderByBookName extends HttpServlet{

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String bookName=req.getParameter("bookname");
        String name=(String)req.getSession().getAttribute("username");
        Member member=new MemberDao().getMemberByName(name);
        List<OrderForm> list=new OrderDao().getOrderFormByBookName(member.getId(),bookName);
        req.setAttribute("list",list);
        req.getRequestDispatcher("/OrderSearchResult.jsp").forward(req,resp);
    }
    
}
